Class symantec.itools.awt.ButtonBase
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class symantec.itools.awt.ButtonBase

Object
   |
   +----Component
           |
           +----Canvas
                   |
                   +----symantec.itools.awt.ButtonBase

public abstract class ButtonBase
extends Canvas
An abstract class used to implement special Symantec buttons. It supports 3-D beveled borders, and the posting of continuous notification events while the button is pressed.

Version:
1.1, June 26, 1997
Author:
Symantec

Variable Index

 o bevel
The "height" (cross-section) of a beveled edge, in pixels.
 o borderColor
The color of the border around the button.
 o buttonColor
The color of the content of the button.
 o buttonImage
The offscreen buffer to draw the button in.
 o buttonImageGraphics
The Graphics of the offscreen buffer to draw the button in.
 o context
Applet context that shows the document.
 o errors
Error strings.
 o frame
Frame specifier for showing a URL document in a browser or applet viewer.
 o inButton
True if the mouse is over this button.
 o isAdded
Keeps track of wheather or not the button is added to a container.
 o linkURL
The URL of the document to show when the button is clicked.
 o notified
True if a notification has been posted in response to a mouse down.
 o notifyDelay
The delay in milliseconds between notifications while the button is pressed.
 o notifyTimer
Timer used to time notification events while button pressed.
 o notifyWhilePressed
If true the button will continuously post events while pressed.
 o pressed
True if the button is currently pressed.
 o pressedAdjustment
A drawing location adjustment for the 3-D bevel while button is pressed.
 o released
True if the button has been released.
 o running
True if the notify timer is running.
 o showFocus
If true this component will visually indicate when it has the focus.
 o showURLStatus
If true show the linkURL in the status area when the mouse is over the button.
 o tempBevelHeight
Internal use.
 o useOffset
If true set pressedAdjustment accordingly, else, it is always 0.

Constructor Index

 o symantec.itools.awt.ButtonBase()
Constructs a default ButtonBase.

Method Index

 o addActionListener(ActionListener)
Adds the specified action listener to receive action events from this button.
 o addBevelHeightListener(PropertyChangeListener)
Adds a listener for the BevelHeight property changes.
 o addBevelHeightListener(VetoableChangeListener)
Adds a vetoable listener for the BevelHeight property changes.
 o addFrameListener(PropertyChangeListener)
Adds a listener for the Frame property changes.
 o addFrameListener(VetoableChangeListener)
Adds a vetoable listener for the Frame property changes.
 o addNotify()
Tells this component that it has been added to a container.
 o addPropertyChangeListener(PropertyChangeListener)
Adds a listener for all event changes.
 o addVetoableChangeListener(VetoableChangeListener)
Adds a vetoable listener for all event changes.
 o disable()
 o enable()
 o getActionCommand()
Returns the command name of the action event fired by this button.
 o getBevelHeight()
Returns the current "height" (cross-section) of a beveled edge, in pixels.
 o getBorderColor()
Gets the current border color.
 o getButtonColor()
Gets the current button color.
 o getFrame()
Gets the frame specifier for showing a URL document in a browser or applet viewer.
 o getLinkURL()
Returns the URL of the document to link to when the button is clicked.
 o getMinimumSize()
Returns the minimum dimensions to properly display this component.
 o getNotifyDelay()
Returns the current delay in milliseconds between notification events.
 o getNotifyWhilePressed()
 o getPreferredSize()
Returns the recommended dimensions to properly display this component.
 o getShowFocus()
 o isButtonImageInvalid()
Returns true if a button image has been set, but it is not the size of this component.
 o isFocusTraversable()
 o isNotifyWhilePressed()
Gets whether the button will continuously post events while pressed.
 o isShowFocus()
Gets whether this component will visually indicate when it has the focus.
 o isShowURLStatus()
If true show the linkURL in the status area when the mouse is over the button.
 o isUseOffset()
Gets whether objects in the button will be offset down and to the right by the bevel height amount or not.
 o isValidBevelSize(int)
Is the given bevel size valid for this button.
 o isValidFrame(String)
Is the given frame string valid.
 o linkToURL()
Tell the browser to show the document referenced by the linkURL.
 o minimumSize()
 o paint(Graphics)
Paints this component using the given graphics context.
 o preferredSize()
 o removeActionListener(ActionListener)
Removes the specified action listener so it no longer receives action events from this button.
 o removeBevelHeightListener(PropertyChangeListener)
Removes a listener for the BevelHeight property changes.
 o removeBevelHeightListener(VetoableChangeListener)
Removes a vetoable listener for the BevelHeight property changes.
 o removeFrameListener(PropertyChangeListener)
Removes a listener for the Frame property changes.
 o removeFrameListener(VetoableChangeListener)
Removes a vetoable listener for the Frame property changes.
 o removeNotify()
Tells this component that it is being removed from a container.
 o removePropertyChangeListener(PropertyChangeListener)
Removes a listener for all event changes.
 o removeVetoableChangeListener(VetoableChangeListener)
Removes a vetoable listener for all event changes.
 o setActionCommand(String)
Sets the command name of the action event fired by this button.
 o setAppletContext(AppletContext)
Sets the applet context used to view documents.
 o setBevelHeight(int)
Sets the "height" (cross-section) of a beveled edge, in pixels.
 o setBorderColor(Color)
Sets the current border color.
 o setButtonColor(Color)
Sets the current button color.
 o setEnabled(boolean)
Enables this component so that it will respond to user input.
 o setFrame(String)
Sets the frame specifier for showing a URL document in a browser or applet viewer.
 o setLinkURL(URL)
Sets the URL of the document to link to when the button is clicked.
 o setNotifyDelay(int)
Sets the notification event delay in milliseconds.
 o setNotifyWhilePressed(boolean)
Sets whether the button will continually post notify events while pressed.
 o setShowFocus(boolean)
Sets whether this component will visually indicate when it has the focus.
 o setShowURLStatus(boolean)
Sets whether the linkURL will be displayed in the status area when the mouse is over the button.
 o setUseOffset(boolean)
Sets whether objects in the button will be offset down and to the right by the bevel height amount or not.
 o simulateClick()
Makes the button act as if it was pressed, drawing as if it were clicked and sending an action event as if it were clicked.
 o sourceActionEvent()
Fire an action event to the listeners.
 o update(Graphics)
Handles redrawing of this component on the screen.
 o updateButtonImage()
Maintains the buttonImage size and draws the button in the buttonImage offscreen image.
 o validate()
Ensures that this component is laid out properly, as needed.
 o verifyContstrainedPropertyValues()
Called after addNotify to set the internally constrined properties to their temporary values to validate them now that the component has been added to the form.

Variables

 o bevel
protected int bevel
The "height" (cross-section) of a beveled edge, in pixels.

 o borderColor
protected java.awt.Color borderColor
The color of the border around the button.

 o buttonColor
protected java.awt.Color buttonColor
The color of the content of the button. The highlights are derived from this color.

 o buttonImage
protected transient java.awt.Image buttonImage
The offscreen buffer to draw the button in.

 o buttonImageGraphics
protected transient java.awt.Graphics buttonImageGraphics
The Graphics of the offscreen buffer to draw the button in.

 o context
protected transient java.applet.AppletContext context
Applet context that shows the document.

 o errors
protected transient java.util.ResourceBundle errors
Error strings.

 o frame
protected java.lang.String frame
Frame specifier for showing a URL document in a browser or applet viewer. It is interpreted as follows:

 o inButton
protected transient boolean inButton
True if the mouse is over this button.

 o isAdded
protected transient boolean isAdded
Keeps track of wheather or not the button is added to a container. Check before attempting to getFontMetrics() to avoid getting a null pointer.

 o linkURL
protected java.net.URL linkURL
The URL of the document to show when the button is clicked.

 o notified
protected transient boolean notified
True if a notification has been posted in response to a mouse down.

 o notifyDelay
protected int notifyDelay
The delay in milliseconds between notifications while the button is pressed.

 o notifyTimer
protected symantec.itools.util.Timer notifyTimer
Timer used to time notification events while button pressed.

 o notifyWhilePressed
protected boolean notifyWhilePressed
If true the button will continuously post events while pressed.

 o pressed
protected transient boolean pressed
True if the button is currently pressed.

 o pressedAdjustment
protected int pressedAdjustment
A drawing location adjustment for the 3-D bevel while button is pressed.

 o released
protected transient boolean released
True if the button has been released.

 o running
protected transient boolean running
True if the notify timer is running.

 o showFocus
protected boolean showFocus
If true this component will visually indicate when it has the focus. This is done by drawing a focus rectangle within the component as needed.

 o showURLStatus
protected boolean showURLStatus
If true show the linkURL in the status area when the mouse is over the button. If the linkURL is null, nothing is displayed, regardless of this flag. This flag also controls erasing of the status area after the URL has been displayed.

 o tempBevelHeight
protected int tempBevelHeight
Internal use. Bevel height value stored until this component is added to a container. It is then used to set the real bevel height value. This avoids code-gen order dependencies.

 o useOffset
protected boolean useOffset
If true set pressedAdjustment accordingly, else, it is always 0.

Constructors

 o ButtonBase
protected ButtonBase()
Constructs a default ButtonBase. The defaults are no notifyWhilePressed, no offset, and a bevel height of 2.

Methods

 o addActionListener
public synchronized void addActionListener(ActionListener l)
Adds the specified action listener to receive action events from this button.

Parameters:
l - the action listener
 o addBevelHeightListener
public synchronized void addBevelHeightListener(PropertyChangeListener listener)
Adds a listener for the BevelHeight property changes.

Parameters:
listener - the listener to add.
See Also:
removeBevelHeightListener(java.beans.PropertyChangeListener)
 o addBevelHeightListener
public synchronized void addBevelHeightListener(VetoableChangeListener listener)
Adds a vetoable listener for the BevelHeight property changes.

Parameters:
listener - the listener to add.
See Also:
removeBevelHeightListener(java.beans.VetoableChangeListener)
 o addFrameListener
public synchronized void addFrameListener(PropertyChangeListener listener)
Adds a listener for the Frame property changes.

Parameters:
listener - the listener to add.
See Also:
removeFrameListener(java.beans.PropertyChangeListener)
 o addFrameListener
public synchronized void addFrameListener(VetoableChangeListener listener)
Adds a vetoable listener for the Frame property changes.

Parameters:
listener - the listener to add.
See Also:
removeFrameListener(java.beans.VetoableChangeListener)
 o addNotify
public synchronized void addNotify()
Tells this component that it has been added to a container. This is a standard Java AWT method which gets called by the AWT when this component is added to a container. Typically, it is used to create this component's peer. It has been overridden here to hook-up event listeners.

Overrides:
addNotify in class Canvas
See Also:
removeNotify
 o addPropertyChangeListener
public synchronized void addPropertyChangeListener(PropertyChangeListener listener)
Adds a listener for all event changes.

Parameters:
listener - the listener to add.
See Also:
removePropertyChangeListener
 o addVetoableChangeListener
public synchronized void addVetoableChangeListener(VetoableChangeListener listener)
Adds a vetoable listener for all event changes.

Parameters:
listener - the listener to add.
See Also:
removeVetoableChangeListener
 o disable
public void disable()
Note: disable() is deprecated.

Overrides:
disable in class Component
See Also:
setEnabled
 o enable
public void enable()
Note: enable() is deprecated.

Overrides:
enable in class Component
See Also:
setEnabled
 o getActionCommand
public java.lang.String getActionCommand()
Returns the command name of the action event fired by this button.

Returns:
the action command name
 o getBevelHeight
public int getBevelHeight()
Returns the current "height" (cross-section) of a beveled edge, in pixels.

Returns:
the current bevel height in pixels.
See Also:
setBevelHeight
 o getBorderColor
public java.awt.Color getBorderColor()
Gets the current border color.

Returns:
the current border color
See Also:
setBorderColor
 o getButtonColor
public java.awt.Color getButtonColor()
Gets the current button color.

Returns:
the current button color
See Also:
setButtonColor
 o getFrame
public java.lang.String getFrame()
Gets the frame specifier for showing a URL document in a browser or applet viewer. It is interpreted as follows:

Returns:
the frame specifier
See Also:
setFrame, frameTarget_self, frameTarget_parent, frameTarget_top, frameTarget_blank
 o getLinkURL
public java.net.URL getLinkURL()
Returns the URL of the document to link to when the button is clicked.

See Also:
setLinkURL
 o getMinimumSize
public java.awt.Dimension getMinimumSize()
Returns the minimum dimensions to properly display this component. This is a standard Java AWT method which gets called to determine the minimum size of this component. It simply returns the results of a call to preferedSize().

Overrides:
getMinimumSize in class Component
 o getNotifyDelay
public int getNotifyDelay()
Returns the current delay in milliseconds between notification events.

See Also:
setNotifyWhilePressed, setNotifyDelay
 o getNotifyWhilePressed
public boolean getNotifyWhilePressed()
Note: getNotifyWhilePressed() is deprecated.

See Also:
isNotifyWhilePressed
 o getPreferredSize
public java.awt.Dimension getPreferredSize()
Returns the recommended dimensions to properly display this component. This is a standard Java AWT method which gets called to determine the recommended size of this component.

Overrides:
getPreferredSize in class Component
 o getShowFocus
public boolean getShowFocus()
Note: getShowFocus() is deprecated.

See Also:
isShowFocus
 o isButtonImageInvalid
protected boolean isButtonImageInvalid()
Returns true if a button image has been set, but it is not the size of this component.

 o isFocusTraversable
public boolean isFocusTraversable()
Overrides:
isFocusTraversable in class Component
 o isNotifyWhilePressed
public boolean isNotifyWhilePressed()
Gets whether the button will continuously post events while pressed.

Returns:
true if it will continuously post events while pressed, false otherwise
See Also:
setNotifyWhilePressed, setNotifyDelay, getNotifyDelay
 o isShowFocus
public boolean isShowFocus()
Gets whether this component will visually indicate when it has the focus. This is done by drawing a focus rectangle within the component as needed.

Returns:
true if the focus is visually indicated, false if the focus is never indicated
See Also:
setShowFocus
 o isShowURLStatus
public boolean isShowURLStatus()
If true show the linkURL in the status area when the mouse is over the button. If the linkURL is null, nothing is displayed, regardless of this flag. This flag also controls erasing of the status area after the URL has been displayed.

Returns:
true if the linkURL will be displayed in the status area when the mouse is over the button.
See Also:
setShowURLStatus
 o isUseOffset
public boolean isUseOffset()
Gets whether objects in the button will be offset down and to the right by the bevel height amount or not. This also impacts the way the button is drawn when it is pressed.

Returns:
true if bevel offset is used
See Also:
setUseOffset
 o isValidBevelSize
protected boolean isValidBevelSize(int i)
Is the given bevel size valid for this button.

Parameters:
i - the given bevel size
Returns:
true if the given bevel size is acceptable, false if not.
 o isValidFrame
protected boolean isValidFrame(String string)
Is the given frame string valid.

Parameters:
string - the given frame
Returns:
true if the given frame is acceptable, false if not. To be valid it has to be null, or one of the four strings below:
See Also:
frameTarget_self, frameTarget_parent, frameTarget_top, frameTarget_blank
 o linkToURL
protected void linkToURL()
Tell the browser to show the document referenced by the linkURL. If the frame specifier is not null or empty, then tell the browser to open the document with that frame.

 o minimumSize
public java.awt.Dimension minimumSize()
Note: minimumSize() is deprecated.

Overrides:
minimumSize in class Component
See Also:
getMinimumSize
 o paint
public void paint(Graphics g)
Paints this component using the given graphics context. This is a standard Java AWT method which typically gets called by the AWT to handle painting this component. It paints this component using the given graphics context. The graphics context clipping region is set to the bounding rectangle of this component and its [0,0] coordinate is this component's top-left corner.

Parameters:
g - the graphics context used for painting
Overrides:
paint in class Canvas
See Also:
repaint, update
 o preferredSize
public java.awt.Dimension preferredSize()
Note: preferredSize() is deprecated.

Overrides:
preferredSize in class Component
See Also:
getPreferredSize
 o removeActionListener
public synchronized void removeActionListener(ActionListener l)
Removes the specified action listener so it no longer receives action events from this button.

Parameters:
l - the action listener
 o removeBevelHeightListener
public synchronized void removeBevelHeightListener(PropertyChangeListener listener)
Removes a listener for the BevelHeight property changes.

Parameters:
listener - the listener to remove.
See Also:
addBevelHeightListener(java.beans.PropertyChangeListener)
 o removeBevelHeightListener
public synchronized void removeBevelHeightListener(VetoableChangeListener listener)
Removes a vetoable listener for the BevelHeight property changes.

Parameters:
listener - the listener to remove.
See Also:
addBevelHeightListener(java.beans.VetoableChangeListener)
 o removeFrameListener
public synchronized void removeFrameListener(PropertyChangeListener listener)
Removes a listener for the Frame property changes.

Parameters:
listener - the listener to remove.
See Also:
addFrameListener(java.beans.PropertyChangeListener)
 o removeFrameListener
public synchronized void removeFrameListener(VetoableChangeListener listener)
Removes a vetoable listener for the Frame property changes.

Parameters:
listener - the listener to remove.
See Also:
addFrameListener(java.beans.VetoableChangeListener)
 o removeNotify
public synchronized void removeNotify()
Tells this component that it is being removed from a container. This is a standard Java AWT method which gets called by the AWT when this component is removed from a container. Typically, it is used to destroy the peers of this component and all its subcomponents. It has been overridden here to unhook event listeners.

Overrides:
removeNotify in class Component
See Also:
addNotify
 o removePropertyChangeListener
public synchronized void removePropertyChangeListener(PropertyChangeListener listener)
Removes a listener for all event changes.

Parameters:
listener - the listener to remove.
See Also:
addPropertyChangeListener
 o removeVetoableChangeListener
public synchronized void removeVetoableChangeListener(VetoableChangeListener listener)
Removes a vetoable listener for all event changes.

Parameters:
listener - the listener to remove.
See Also:
addVetoableChangeListener
 o setActionCommand
public void setActionCommand(String command) throws PropertyVetoException
Sets the command name of the action event fired by this button.

Parameters:
command - The name of the action event command fired by this button
Throws: PropertyVetoException
if the specified property value is unacceptable
 o setAppletContext
protected void setAppletContext(AppletContext c)
Sets the applet context used to view documents.

Parameters:
c - the new applet context
 o setBevelHeight
public void setBevelHeight(int height) throws PropertyVetoException
Sets the "height" (cross-section) of a beveled edge, in pixels.

Parameters:
height - the size of the bevel in pixels
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getBevelHeight
 o setBorderColor
public void setBorderColor(Color color) throws PropertyVetoException
Sets the current border color.

Parameters:
color - the new border color
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getBorderColor
 o setButtonColor
public void setButtonColor(Color color) throws PropertyVetoException
Sets the current button color.

Parameters:
color - the new button color. The highlights of the button are derived from this color.
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getButtonColor
 o setEnabled
public void setEnabled(boolean flag)
Enables this component so that it will respond to user input. This is a standard Java AWT method which gets called to enable or disable this component. Once enabled this component will respond to user input.

Parameters:
flag - true if the component is to be enabled; false if it is to be disabled.
Overrides:
setEnabled in class Component
See Also:
isEnabled
 o setFrame
public void setFrame(String newFrame) throws PropertyVetoException
Sets the frame specifier for showing a URL document in a browser or applet viewer. It is interpreted as follows:

Parameters:
newFrame - the frame specifier
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getFrame, frameTarget_self, frameTarget_parent, frameTarget_top, frameTarget_blank
 o setLinkURL
public void setLinkURL(URL url) throws PropertyVetoException
Sets the URL of the document to link to when the button is clicked.

Parameters:
url - the URL
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
getLinkURL
 o setNotifyDelay
public void setNotifyDelay(int delay) throws PropertyVetoException
Sets the notification event delay in milliseconds.

Parameters:
delay - the delay between notification events in milliseconds
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
setNotifyWhilePressed, getNotifyDelay
 o setNotifyWhilePressed
public void setNotifyWhilePressed(boolean flag) throws PropertyVetoException
Sets whether the button will continually post notify events while pressed.

Parameters:
flag - true to post notify events; false to not post events
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
isNotifyWhilePressed, setNotifyDelay, getNotifyDelay
 o setShowFocus
public void setShowFocus(boolean flag) throws PropertyVetoException
Sets whether this component will visually indicate when it has the focus. This is done by drawing a focus rectangle within the component as needed.

Parameters:
flag - true to visually indicate focus, false to never indicate focus
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
isShowFocus
 o setShowURLStatus
public void setShowURLStatus(boolean flag) throws PropertyVetoException
Sets whether the linkURL will be displayed in the status area when the mouse is over the button. This flag also controls erasing of the status area after the URL has been displayed.

Parameters:
flag - true if the linkURL will be displayed in the status area when the mouse is over the button; false if not.
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
isShowURLStatus
 o setUseOffset
public void setUseOffset(boolean flag) throws PropertyVetoException
Sets whether objects in the button will be offset down and to the right by the bevel height amount or not. This also impacts the way the button is drawn when it is pressed.

Parameters:
flag - true to have objects use the offset; false to have objects not move.
Throws: PropertyVetoException
if the specified property value is unacceptable
See Also:
isUseOffset, setBevelHeight, getBevelHeight
 o simulateClick
public void simulateClick()
Makes the button act as if it was pressed, drawing as if it were clicked and sending an action event as if it were clicked.

 o sourceActionEvent
protected void sourceActionEvent()
Fire an action event to the listeners.

 o update
public void update(Graphics g)
Handles redrawing of this component on the screen. This is a standard Java AWT method which gets called by the Java AWT (repaint()) to handle repainting this component on the screen. The graphics context clipping region is set to the bounding rectangle of this component and its [0,0] coordinate is this component's top-left corner. Typically this method paints the background color to clear the component's drawing space, sets graphics context to be the foreground color, and then calls paint() to draw the component. It is overridden here to prevent the flicker associated with the standard update() method's repainting of the background before painting the component itself.

Parameters:
g - the graphics context
Overrides:
update in class Component
See Also:
repaint, paint
 o updateButtonImage
protected void updateButtonImage()
Maintains the buttonImage size and draws the button in the buttonImage offscreen image.

See Also:
paint
 o validate
public void validate()
Ensures that this component is laid out properly, as needed. This is a standard Java AWT method which gets called by the AWT to make sure this component and its subcomponents have a valid layout. If this component was made invalid with a call to invalidate(), then it is laid out again. It is overridden here to locate the applet containing this component.

Overrides:
validate in class Component
See Also:
invalidate
 o verifyContstrainedPropertyValues
protected void verifyContstrainedPropertyValues()
Called after addNotify to set the internally constrined properties to their temporary values to validate them now that the component has been added to the form. This is used to avoid code-gen order dependencies, since VC generates all property manipulating code before adding the component to its container. Subclasses should override this function for any internally constrained properties, and call the super version in the overridden version.


All Packages  Class Hierarchy  This Package  Previous  Next  Index